﻿<cfscript>
    view = createObject("component", "#session.rootDir#.views.layout");
    view.init("Dynamic Group Management", "","", main);
    view.setSideBar("noSidebar");
    view.html();        
</cfscript>

<cffunction name="main" access="public" output="true" returntype="any">
    <cfsetting  requesttimeout="5000"/>
    <cfparam default="none" name="url.SCFResource" />
    <cfscript>
        import models.*;
        Groups = createObject("component", "#session.rootDir#.objects.Groups").init();
        Users = createObject("component", "#session.rootDir#.objects.Users").init();
        AjaxController = '/#session.rootDir#/controller/AjaxHandler.cfm';
        ViewUser = "/#session.rootDir#/users/viewuser.cfm?ADUser=";
        ViewGroup = "/#session.rootDir#/groups/viewgroup.cfm?ADGroup=";
        Resources = entityload("Resources", {Resource = url.SCFResource});
        PathURL = {'\\SCFWEB1\CFMX\SCF Intranet' = 'http://www.scfonline.net/'};
    </cfscript>
    
    <input type="hidden" id="ViewUser" value="#ViewUser#"/ >
    <input type="hidden" id="ViewGroup" value="#ViewGroup#"/ >

    <h3>Resources</h3>
    <table class="dataTable">
        <tr>
            <th>Name</th>
            <th>Location</th>
            <th>Owner</th>
            <th>Alternates</th>
            <th>Type</th>
        </tr>
        
        <cfloop from="1" to="#ArrayLen(Resources)#" index="i">
            <tr>
                <td>#Resources[i].getResource()#</td>
                <td><a href="#PathURL[Resources[i].getLocation()]##Resources[i].getResource()#">#PathURL[Resources[i].getLocation()]##Resources[i].getResource()#</a></td>
                <td>#Resources[i].getResourceOwner()#</td>
                <td>#Resources[i].getDesignees()#</td>
                <td>
                    <cfset ResourceType = ormExecuteQuery("FROM ResourceTypes WHERE ResourceTypeID = #Resources[i].getResourceTypeID()#") />
                    #ResourceType[1].getResourceType()#
                </td>
            </tr>
        </cfloop>
    </table>
    
</cffunction>